package com.idriver.service;

import com.idriver.bean.Student;
import com.idriver.dao.StudentDao;
import com.idriver.dao.StudentDaoImpl;

import java.util.List;

public class StudentService {

    StudentDao studentDao = null;

    public StudentService() {
        this.studentDao = new StudentDaoImpl();
    }

    /**
     * 增加一个学员
     * @param student
     * @return
     */
    public int addStudent(Student student) {

        return studentDao.addStudent(student);
    }

    /**
     * 获取学员信息列表
     * @param page
     * @param size
     * @param keyword
     * @return
     */
    public List<Student> getStudentsLists(int page, int size, String keyword) {

        return studentDao.getStudentLists(page, size, keyword);
    }

    /**
     * 获取学员信息总条数
     * @param keyword
     * @return
     */
    public int getStudentsListNum(String keyword) {

        return studentDao.getStudentListNum(keyword);
    }

    /**
     * 编辑学员信息
     * @param student
     * @return
     */
    public int editStudent(Student student) {

        return studentDao.editStudent(student);
    }

    /**
     * 删除一个学员
     * @param id
     * @return
     */
    public int delStudent(int id) {

        return studentDao.delStudent(id);
    }

    /**
     * 根据学员学号id, 查找该学员的全部信息
     * @param id
     * @return
     */
    public Student findStudentById(int id) {
        return studentDao.findStudentById(id);
    }
}
